package com.znyj.cloud.device.pack;

import com.alibaba.fastjson.JSONObject;
import com.znyj.cloud.device.constant.SysConstant;
import org.apache.log4j.Logger;

import java.sql.Timestamp;

/**
 * Created by gaoliwei02 on 17/5/30.
 */

public class TaskReceivePackage extends BasePackage {
    private static final Logger logger = Logger.getLogger(TaskReceivePackage.class);

    public String reportJson() {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("returnMsg", returnMsg);
        jsonObject.put("reportTime", reportTime);
        jsonObject.put("deviceId", deviceId);
        jsonObject.put("orderId", orderId);
        return jsonObject.toString();
    }

    public void parseJsonData(JSONObject json) {
        deviceId = json.getString(SysConstant.CTRL_KEY.IMEI);
        orderId = json.getLong(SysConstant.CTRL_KEY.ORDER_ID);
        reportTime = new Timestamp(System.currentTimeMillis());
        returnMsg = json.getString(SysConstant.CTRL_KEY.CS_MSG);
    }

    private long orderId;

    private String deviceId;
    //回复消息
    private String returnMsg;
    //这次汇报时间
    private Timestamp reportTime;

    public String getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }

    public String getReturnMsg() {
        return returnMsg;
    }

    public void setReturnMsg(String returnMsg) {
        this.returnMsg = returnMsg;
    }

    public Timestamp getReportTime() {
        return reportTime;
    }

    public void setReportTime(Timestamp reportTime) {
        this.reportTime = reportTime;
    }

    public long getOrderId() {
        return orderId;
    }

    public void setOrderId(long orderId) {
        this.orderId = orderId;
    }
}
